package com.dongrj.framework.web.utils;

import com.dongrj.framework.core.constant.Constant;
import com.dongrj.framework.core.exception.Assert;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * @author dongrongjun
 * @date 2020/4/2
 */
public class SpringBootUtils {

    /**
     * Spring 启动
     *
     * @param applicationClass Spring Boot Main类
     * @param args             参数
     */
    public static ConfigurableApplicationContext start(Class<?> applicationClass, String[] args) {
        String property = System.getProperty(Constant.App.SPRING_ACTIVE);
        Assert.notEmpty(property, Constant.App.SPRING_ACTIVE + "必须被设置!");
        return SpringApplication.run(applicationClass, args);
    }
}
